import tensorflow as tf
from tensorflow.keras.datasets import mnist
from keras.utils import np_utils
from MNISTModel import create_model
from DataGenerator import *
import os


if __name__ == '__main__':
    os.environ['CUDA_VISIBLE_DEVICES'] = '0'
    physical_devices = tf.config.experimental.list_physical_devices('GPU')
    assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
    tf.config.experimental.set_memory_growth(physical_devices[0], True)

    model=create_model()
    model.load_weights("./resources/MNIST_model_swlw/")
    x_test, y_test = getTestData()
    loss, acc = model.evaluate(x_test, y_test)
    print("Restored model, accuracy:{:5.2f}%".format(100 * acc))